import request from '@/utils/request'

let village = 'service-village'

/**
 * 获取业主饼状图
 * @returns {AxiosPromise}
 */
export function getOwnerEcharts(){
  return request({
    url: village + '/village/owner/getOwnerEcharts',
    method:'get'
  })
}

/**
 * 条件查询业主信息
 * @param query
 * @returns {AxiosPromise}
 */
export function queryOwnerList(query) {
  return request({
    url: village+'/village/owner/queryOwner',
    method: 'get',
    params: query
  })
}

/**
 * 根据id获取业主信息
 * @param id
 * @returns {AxiosPromise}
 */
export function getOwnerById(id){
  return request({
    url: village + '/village/owner/getOwnerById/'+id,
    method: 'get'
  })
}

/**
 * 添加业主
 * @param owner
 * @returns {AxiosPromise}
 */
export function addOwner(owner){
  return request({
    url: village + '/village/owner/addOwner',
    method: 'post',
    data: owner
  })
}

/**
 * 删除业主
 * @param ownerId
 * @returns {AxiosPromise}
 */
export function deleteOwner(ownerId){
  return request({
    url: village + '/village/owner/deleteOwner/'+ownerId,
    method: 'get'
  })
}

/**
 * 修改业主
 * @param owner
 * @returns {AxiosPromise}
 */
export function updateOwner(owner){
  return request({
    url: village + '/village/owner/updateOwner',
    method: 'post',
    data: owner
  })
}

/**
 * 给业主绑定房间
 * @param ownerId
 * @param roomId
 * @returns {AxiosPromise}
 */
export function ownerAddRoom(ownerId,roomId){
  return request({
    url: village + '/village/owner/ownerAddRoom/'+ownerId+'/'+roomId,
    method:'get'
  })
}

/**
 * 根据业主id获取业主房屋信息
 * @param ownerId
 * @returns {AxiosPromise}
 */
export function getOwnerRoomList(ownerId){
  return request({
    url: village + "/village/ownerRoom/getOwnerRoomList/"+ownerId,
    method: 'get'
  })
}

/**
 * 删除业主房屋
 * @param oid
 * @param rid
 * @returns {AxiosPromise}
 */
export function removeRoom(oid,rid){
  return request({
    url:village + '/village/ownerRoom/removeRoom/'+oid+'/'+rid,
    method:'get'
  })
}

/**
 * 获取业主成员信息
 * @param ownerId
 * @returns {AxiosPromise}
 */
export function getOwnerFamily(ownerId){
  return request({
    url: village +'/village/owner/getOwnerFamily/'+ownerId,
    method: 'get'
  })
}

/**
 * 给业主添加成员
 * @param owner
 * @returns {AxiosPromise}
 */
export function addOwnerFamily(owner){
  return request({
    url: village + '/village/owner/addOwnerFamily',
    method: 'post',
    data: owner
  })
}










